package com.iwhalecloud.bss.kite.cucc.client.dto.pos;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import io.swagger.annotations.ApiModelProperty;

public class KitePosGoodsDTO extends KitePosBaseDTO {

    @ApiModelProperty("商品实例ID")
	private String instanceId;

	@ApiModelProperty("父商品实例ID")
	private String parentInstId;

	@ApiModelProperty("商品编码")
	private String code;

	@ApiModelProperty("商品名称")
	private String name;

	@ApiModelProperty("商品分类编码")
	private String catagoryId;

	@ApiModelProperty("商品数量")
	private Integer count;

	@ApiModelProperty("账户实例ID")
	private String accountInstId;

	@ApiModelProperty("用户实例ID")
	private String userInstId;

	@ApiModelProperty("支付实例ID")
	private String paymentInstId;

	@ApiModelProperty("配送实例ID")
	private String deliveryInstId;

	@ApiModelProperty("合同实例ID")
	private String contractInstId;

	@ApiModelProperty("折扣审批单实例ID")
	private String discountInstId;

	@ApiModelProperty("修改标记")
	private String changeType;

	@ApiModelProperty("对端主键")
	private String destItemId;

	@ApiModelProperty("销售商品编码")
	private String saleGoodsCode;

	@ApiModelProperty("销售商品名称")
	private String saleGoodsName;

    @ApiModelProperty("销售商品生效时间")
    private String startDate;

    @ApiModelProperty("销售商品失效时间")
    private String endDate;

	@ApiModelProperty("付费关系")
	private List<KitePosGoodsPayRealtionDTO> payRelation;

	@ApiModelProperty("资费")
	private List<KitePosGoodsFeeDTO> fees;

	@ApiModelProperty("活动")
	private List<KitePosGoodsActivityDTO> activity;

	@ApiModelProperty("产品")
	private List<KitePosProductDTO> products;

	public String getInstanceId() {
		return instanceId;
	}

	public void setInstanceId(String instanceId) {
		this.instanceId = instanceId;
	}

	public String getParentInstId() {
		return parentInstId;
	}

	public void setParentInstId(String parentInstId) {
		this.parentInstId = parentInstId;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCatagoryId() {
		return catagoryId;
	}

	public void setCatagoryId(String catagoryId) {
		this.catagoryId = catagoryId;
	}

	public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public String getAccountInstId() {
		return accountInstId;
	}

	public void setAccountInstId(String accountInstId) {
		this.accountInstId = accountInstId;
	}

	public String getUserInstId() {
		return userInstId;
	}

	public void setUserInstId(String userInstId) {
		this.userInstId = userInstId;
	}

	public String getPaymentInstId() {
		return paymentInstId;
	}

	public void setPaymentInstId(String paymentInstId) {
		this.paymentInstId = paymentInstId;
	}

	public String getDeliveryInstId() {
		return deliveryInstId;
	}

	public void setDeliveryInstId(String deliveryInstId) {
		this.deliveryInstId = deliveryInstId;
	}

	public String getContractInstId() {
		return contractInstId;
	}

	public void setContractInstId(String contractInstId) {
		this.contractInstId = contractInstId;
	}

	public String getDiscountInstId() {
		return discountInstId;
	}

	public void setDiscountInstId(String discountInstId) {
		this.discountInstId = discountInstId;
	}

	public String getChangeType() {
		return changeType;
	}

	public void setChangeType(String changeType) {
		this.changeType = changeType;
	}

	public String getDestItemId() {
		return destItemId;
	}

	public void setDestItemId(String destItemId) {
		this.destItemId = destItemId;
	}

	public String getSaleGoodsCode() {
		return saleGoodsCode;
	}

	public void setSaleGoodsCode(String saleGoodsCode) {
		this.saleGoodsCode = saleGoodsCode;
	}

	public String getSaleGoodsName() {
		return saleGoodsName;
	}

	public void setSaleGoodsName(String saleGoodsName) {
		this.saleGoodsName = saleGoodsName;
	}

	public List<KitePosGoodsPayRealtionDTO> getPayRelation() {
		return payRelation;
	}

	public void setPayRelation(List<KitePosGoodsPayRealtionDTO> payRelation) {
		this.payRelation = payRelation;
	}

	public List<KitePosGoodsFeeDTO> getFees() {
		return fees;
	}

	public void setFees(List<KitePosGoodsFeeDTO> fees) {
		this.fees = fees;
	}

	public List<KitePosGoodsActivityDTO> getActivity() {
		return activity;
	}

	public void setActivity(List<KitePosGoodsActivityDTO> activity) {
		this.activity = activity;
	}

	public List<KitePosProductDTO> getProducts() {
	    if (products == null) {
	        products = new ArrayList<>();
	    }
		return products;
	}

	public void setProducts(List<KitePosProductDTO> products) {
		this.products = products;
	}

	public String getAttrValue(String fieldName) {
		List<KitePosAttrDTO> attrs = this.getAttrs().stream().filter((attr) -> attr.getCode().equals(fieldName)).collect(Collectors.toList());
		if (attrs != null && !attrs.isEmpty()) {
			return attrs.get(0).getValue();
		}
		return null;
	}

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }
}
